<?php
/**
 * Created by PhpStorm.
 * User: liuhong
 * Date: 2019-04-08
 * Time: 15:32
 */

namespace app\api\controller;

use app\common\model\Article as ArticleModel;
use app\common\model\Material as MaterialModel;
use app\common\model\Card as CardModel;
use app\common\model\Student;

class Money extends Base
{
    public $moneyModel;

    public function __construct()
    {
        parent::__construct();
        $this->moneyModel = new \app\common\model\Money();
    }

    /**
     * @return object|\think\View
     */
    public function detail()
    {
        if (request()->isPost()) {
            $data = input('');
            $where = [
//                'uid' => $this->uid,
                'id' => $data['sid']
            ];
//            $money = $this->moneyModel->where($where)->find();
            $money = Student::getOne($where);
            if ($money) {
                $money['pay_time'] = date('Y年m月d日',$money['pay_time']);
                $money['lose_time'] = date('Y年m月d日',$money['lose_time']);
                if($money['tuijian']){
                    $money['tuijian'] = explode(',',$money['tuijian']);
                }else{
                    $money['tuijian'] = [];
                }

                return returnJson(200, '', $money);
            }
        }
        return returnJson(202, '暂无缴费记录');
    }


}